﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace CustomAuthorizationDemo.Authorization
{
    /// <summary>
    /// IPermissionChecker接口的缺省实现，所有权限检查都将返回true
    /// </summary>
    public sealed class NullPermissionChecker : IPermissionChecker
    {
        /// <summary>
        /// 单实例
        /// </summary>
        public static NullPermissionChecker Instance { get; } = new NullPermissionChecker();

        /// <summary>
        /// 此方法始终返回true
        /// </summary>
        public Task<bool> IsGrantedAsync(string permissionName)
        {
            return Task.FromResult(true);
        }

    }

}
